<?php

/**
 * PriceController is the default controller for this application
 */
class PriceController extends BrowseControllerBase {
	/**
	 * Constructor of index
	 */
	public function __construct() {
		parent::__construct ();
	}
	
	/**
	 * The "index" action is the default action for all controllers -- the
	 * landing page of the site.
	 *
	 * @return void
	 *
	 */
	
	public function indexAction() {
		// Get SettingsDataService
		$settingsDataService = new SettingsDataService ();
		$this->setPageTitle ( $settingsDataService->getValue ( SETTINGS_PRICE_LIST_TITLE ) );
		$this->setMetaDescription ( $settingsDataService->getValue ( SETTINGS_PRICE_LIST_META_DESCRIPTION ) );
		$this->setMetaKeywords ( $settingsDataService->getValue ( SETTINGS_PRICE_LIST_META_KEYWORDS ) );
		$this->smarty->assign ( 'PRICE_OPTION_CONTENT_PATH_1', 'Browse/MyAccount/user_signup_1.tpl' );
		
		$this->smarty->assign ( 'SMARTY_CONTENT_PATH', 'Browse/Price/index.tpl' );
		$this->smarty->display ( APPLICATION_PATH . '/Layouts/Browse/MainLayout.tpl' );
	}
	
	public function optionAction() {
		$id = $this->getQuery ( 'id' );
		$id = intval ( $id );
		$settingsDataService = new SettingsDataService ();
		switch ($id) {
			case PACK_OPTION_1 :
				$option_name = PACK_OPTION_NAME_1;
				$option_file = 'Browse/Price/price_option_1.tpl';
				$this->setPageTitle ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_1_TITLE ) );
				$this->setMetaDescription ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_1_META_DESCRIPTION ) );
				$this->setMetaKeywords ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_1_META_KEYWORDS ) );
				break;
			case PACK_OPTION_2 :
				$option_name = PACK_OPTION_NAME_2;
				$option_file = 'Browse/Price/price_option_2.tpl';
				$this->setPageTitle ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_2_TITLE ) );
				$this->setMetaDescription ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_2_META_DESCRIPTION ) );
				$this->setMetaKeywords ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_2_META_KEYWORDS ) );
				break;
			case PACK_OPTION_3 :
				$option_name = PACK_OPTION_NAME_3;
				$option_file = 'Browse/Price/price_option_3.tpl';
				$this->setPageTitle ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_3_TITLE ) );
				$this->setMetaDescription ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_3_META_DESCRIPTION ) );
				$this->setMetaKeywords ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_3_META_KEYWORDS ) );
				break;
			case PACK_OPTION_4 :
				$option_name = PACK_OPTION_NAME_4;
				$option_file = 'Browse/Price/price_option_4.tpl';
				$this->setPageTitle ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_4_TITLE ) );
				$this->setMetaDescription ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_4_META_DESCRIPTION ) );
				$this->setMetaKeywords ( $settingsDataService->getValue ( SETTINGS_PRICE_OPTION_4_META_KEYWORDS ) );
				break;
		}
		
		$this->smarty->assign ( 'id', $id );
		$this->smarty->assign ( 'option_name', $option_name );
		$this->smarty->assign ( 'OPTION_PLAN_CONTENT_PATH', $option_file );
		$this->smarty->assign ( 'SMARTY_CONTENT_PATH', 'Browse/Price/price_option.tpl' );
		$this->smarty->display ( APPLICATION_PATH . '/Layouts/Browse/MainLayout.tpl' );
	}
}
